﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using PmSoft.Entity;
using System.ComponentModel;

namespace Modules.Project.Entitys
{
    /// <summary>
    /// 项目参建企业
    ///</summary>
    [TableName("project_corp")]
    [Description("项目参建企业")]
    [PrimaryKey("Id", AutoIncrement = true)]
    [CacheSetting(true, PropertyNamesOfArea = "ProjectId,CorpId")]
    [Serializable]
    public class ProjectCorp : IEntity, IProjectCorp
    {
        /// <summary>
        /// 主键
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 项目ID
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 企业ID
        ///</summary>
        [Column("corp_id")]
        public int CorpId { get; set; }

        /// <summary>
        /// 担任角色
        ///</summary>
        [Column("role")]
        public 项目参建单位类型 Role { get; set; }

        /// <summary>
        /// 承建状态
        /// </summary>
        [Column("construction_status")]
        public 承建状态? ConstructionStatus { get; set; }

        /// <summary>
        /// 与总包签订合同金额(元)
        ///</summary>
        [Column("contract_amount")]
        public decimal ContractAmount { get; set; }

        /// <summary>
        /// 创建时间
        ///</summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 入场时间
        ///</summary>
        [Column("start_date")]
        public DateTime StartDate { get; set; }

        /// <summary>
        /// 离场时间
        ///</summary>
        [Column("end_date")]
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 负责人名称
        /// </summary>
        [Column("leader_name")]
        public string? LeaderName { get; set; }

        /// <summary>
        /// 负责人名称
        /// </summary>
        [Column("leader_cardno")]
        public string? LeaderCardno { get; set; }

        /// <summary>
        /// 负责人名称
        /// </summary>
        [Column("leader_phone_num")]
        public string? LeaderPhoneNum { get; set; }

        /// <summary>
        /// 项目管理部编码
        /// </summary>
        [Column("project_manage_code")]
        public string? ProjectManageCode { get; set; }

        /// <summary>
        /// 承建内容
        /// </summary>
        [Column("build_content")]
        public string? BuildContent { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return Id; } }

        #endregion IEntity 成员
    }
}